<template>
  <div class="find-car-item">
    <div class="title">
      {{ orderMsg.carModels }}
    </div>
    <div class="user-info" >
      <div class="img">
        <img :src="img" />
      </div>
      <div class="name" :class="orderMsg.userName.length>5?'namePosition':''">
        {{ orderMsg.userName }}
      </div>
      <div class="phone">
        {{ orderMsg.contactWay }}
      </div>
    </div>
    <div></div>
    <div class="time-info">
      <div class="time">
        {{ orderMsg.createTime }}
      </div>
      <slot>
        <div class="order" :class="orderStatus(orderMsg.status)">
          {{ orderMsg.statusText }}
        </div>
      </slot>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    orderMsg: {
      type: Object,
    }
  },
  data() {
    return {
      img: require("../../assets/image/4.png"),
    };
  },
  methods: {
    orderStatus(num) {
      if (this.orderMsg.status == '00') {
        this.orderMsg.statusText = '待生成订单'
      }else if (this.orderMsg.status == '01') {
        this.orderMsg.statusText = '待支付'
      }else if (this.orderMsg.status == '02' || this.orderMsg.status == '03' || this.orderMsg.status == '04' || this.orderMsg.status == '05') {
        this.orderMsg.statusText = '已支付'
      }else if (this.orderMsg.status == '06') {
        this.orderMsg.statusText = '已完结'
      }else if (this.orderMsg.status == '07') {
        this.orderMsg.statusText = '已取消'
      }
       if (num == '00' || num == '01') {
        return "active-wait";
      } else if (num == '02' || num == '03' || num == '04' || num == '05') {
        return "finsh-pay";
      } else if (num == '06' || num == '07') {
        return "finsh";
      }


    }
  }
};
</script>

<style scoped lang="less">
.active-wait {
  color: #fe8a17;
  background-color: rgba(254, 138, 23, 0.1);
  padding: 5px;
  border-radius: 2px;
}
.finsh {
  color: #999999;
  background-color: rgba(153, 153, 153, 0.1);
  padding: 5px;
  border-radius: 2px;
}
.finsh-pay {
  color: #0d7ef0;
  background-color: rgba(13, 126, 240, 0.1);
  padding: 5px;
  border-radius: 2px;
}
.find-car-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  // width: 375px;
  height: 108px;
  background: #ffffff;
  padding: 16px 0;
  color: #333333;
  font-family: PingFangSC-Medium, PingFang SC;
  .title {
    font-size: 16px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .user-info {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 400;
    color: #666666;
    img {
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background-color: #ffdecc;
    }
    .namePosition{
      width: 100px;
      overflow: hidden;
      text-overflow:ellipsis;
      white-space: nowrap;
    }
    .name {
      margin: 0 8px;
      
    }
    .phone {
      margin-left: 8px;
    }
  }
  .time-info {
    display: flex;
    justify-content: space-between;
    // margin-top: 15px;
    .time {
      font-size: 12px;
      font-weight: 400;
      color: #999999;
    }
    .order {
      font-size: 12px;
      font-weight: 400;
    }
  }
}
</style>